﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MRight.aspx.cs" Inherits="Jy123.Web.Manage.MRight" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>管理员－权限</title>
    <link href="css/custom/jquery.ui.css" rel="stylesheet" type="text/css" />
    <link href="css/main.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/jquery.ui.js" type="text/javascript"></script>
    <script src="js/main.js" type="text/javascript"></script>

</head>
<body>
    <form id="form1" runat="server">
    <h4>
        <a href="#"><span>管理员权限</span></a></h4>
    <div class="register">
        <h5>
            权限</h5>
        <ul>
            <li>
                <input id="txtRame" type="text" class="text" runat="server" /><asp:HiddenField ID="hidrid"
                    runat="server" />
            </li>
            <li>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="请输入权限"
                    CssClass="warning" Display="Dynamic" ControlToValidate="txtRame" ForeColor=""></asp:RequiredFieldValidator></li>
        </ul>
        <h5>权限页面</h5>
        <% =chkAll%>
    <asp:HiddenField ID="hidchk" runat="server" />
    <ul class="bb">
        <li>
            <asp:Button ID="btnSubmit" CssClass="button" runat="server" Text="添 加" OnClick="btnSubmit_Click" CommandName="Add" /></li>
    </ul>
    </div>
    <asp:GridView ID="GridView1" runat="server" CssClass="tblist" 
        AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
        DataKeyNames="ID" DataSourceID="SqlDataSource1" 
        onrowediting="GridView1_RowEditing">
        <Columns>
            <asp:TemplateField HeaderText="名称" SortExpression="RName">
                <ItemTemplate>
                    <asp:Label ID="labRName" runat="server" Text='<%# Bind("RName") %>'></asp:Label>
                    <asp:HiddenField ID="hidID" runat="server" Value='<%# Bind("ID") %>' />
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="labRName" runat="server" Text='<%# Bind("RName") %>'></asp:Label>
                    <asp:HiddenField ID="hidID" runat="server" Value='<%# Bind("ID") %>' />
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="授权页面" SortExpression="FMPage">
                <ItemTemplate>
                    <asp:Label ID="labPageItems" runat="server" Text='<%# (Convert.ToInt32(Eval("ID"))==2)?"所有页面":Eval("FMPage") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:Label ID="labPageItems" runat="server" Text='<%# (Convert.ToInt32(Eval("ID"))==2)?"所有页面":Eval("FMPage") %>'></asp:Label>
                </EditItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="操作">
                <ItemTemplate>
                    <asp:LinkButton ID="lbtnEdit" CausesValidation="false" Enabled='<%# (Convert.ToInt32(Eval("ID"))==2)?false:true %>' CommandName="Edit" runat="server" CssClass="btnsty">修改</asp:LinkButton>
                    <asp:LinkButton ID="lbtnDel" Enabled='<%# (Convert.ToInt32(Eval("ID"))<=2)?false:true %>' CausesValidation="false" CommandName="Delete" ForeColor="#CB6E50" runat="server" CssClass="btnsty">删除</asp:LinkButton>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:LinkButton ID="lbtnEdit" CausesValidation="false" CommandName="Edit" runat="server" CssClass="btnsty">修改</asp:LinkButton>
                    <asp:LinkButton ID="lbtnDel" Enabled='<%# (Convert.ToInt32(Eval("ID"))<=2)?false:true %>' CausesValidation="false" CommandName="Delete" ForeColor="#CB6E50" runat="server" CssClass="btnsty">删除</asp:LinkButton>
                </EditItemTemplate>
            </asp:TemplateField>
        </Columns>
            </asp:GridView>
    <script type="text/javascript" language="javascript">
        var selAll = function(chk) {
            if (chk.checked) {
                $('input[type=checkbox][name=s' + chk.id + ']').attr('checked', true);
            }
            else {
                $('input[type=checkbox][name=s' + chk.id + ']').attr('checked', false);
            }
        }
    </script>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        DeleteCommand="DELETE FROM [Manage_Right] WHERE [ID] = @ID" 
        SelectCommand="SELECT [ID], [RName], [FMPage] FROM [Manage_Right] ORDER BY ID DESC">
        <DeleteParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="ID" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    </form>
    <% =Message %>
    </body>
</html>
